home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / DTMFF110 / DTMF_FFT.TXT < prev    next >
Encoding:
Text File  |  1997-08-05  |  12.1 KB  |  259 lines

  1.                 DTMF_FFT version 1.10
  2.            a DTMF & CTCSS generator and decoder &
  3.              a spectrum analyzer program for DOS
  4.     Copyright (C) 1996 Philip VanBaren & (C) 1997 Emil Laurentiu (YO3GGH)
  5.  
  6. PROGRAM FILES:
  7.  
  8. DTMF_FFT.EXE is a program for the Soundblaster compatible cards.
  9.  
  10. The program samples the input, performs an FFT, and graphs the output. It
  11. also decodes and generates DTMF numbers and the sub-audible CTCSS tones.
  12.  
  13. INI file and command line options provide the user with the ability to
  14. select linear/log frequency and amplitude scales as well as sampling rates,
  15. length of the FFT, DTMF generating speed, threshold DTMF and CTCSS level etc.
  16.  
  17. Graphics is done using the VGA 640x480x16 video mode, so a VGA compatible
  18. card is required. The program will only run on computers with an 80386 or
  19. above processor. A coprocessor is recommended, but not required.
  20.  
  21. DTMF_FFT.EXE also works with 8 bit Soundblaster and compatible cards. It
  22. looks for the environment variable "BLASTER=A220 I5 D1" to set the
  23. Soundblaster address, IRQ, and DMA. If this variable is not available, the
  24. default values (220,5,1) are used.
  25.  
  26. COMMAND LINE OPTIONS:
  27.  
  28. -Cnumber selects the sound card (0=SB8, 1=SB16)
  29. -Snumber sets the sampling rate.
  30. -Fnumber sets the length of the FFT.
  31. -Mnumber sets the scale maximum.
  32. -L sets a logarithmic scale for the frequency axis.
  33. -H or -? displays this message.
  34.  
  35. INI File options:
  36.  
  37. These options override the program defaults, but are overridden by the
  38. options specified on the command line. The red,green,blue values for the
  39. colors must be values between 0 and 63.
  40.  
  41. Sound card: 0            ( same as -Cnumber )
  42.      0: Soundblaster 8 bit cards, and compatibles (also valid: SB8)
  43.      1: Soundblaster 16 bit cards          (also valid: SB16)
  44. Sample rate: 20000        ( same as -Snumber )
  45.      Valid sampling rates are 5000 Hz to 88200 Hz for Soundblaster cards.
  46.      However for the old 8-bit Soundblaster cards the sampling rate cannot
  47.      exceed 12000 Hz. Any value greater than this will result in a
  48.      mislabelled frequency axis. For newer Soundblaster cards, sampling
  49.      rates up to (and possibly beyond) 44100 Hz are possible.
  50. FFT length: 1024        ( same as -Fnumber )
  51.      Valid FFT lengths are from 8 to 2048.  Longer FFTs will result in slower
  52.      display updates (maximum update rate will be SampleRate/FFTlength).
  53.      Computers slower than 486DX-33MHz will not be able to reach the maximum
  54.      rate because they cannot perform the calculations in the available time.
  55. Log freq scale: 0        ( 1 = -L )
  56.      0 selects a linear frequency scale (equal distances result in equal
  57.        frequency differences)
  58.      1 selects a logarithmic frequency scale (equal distances result in equal
  59.        frequency ratios)
  60. Max amp: 0.1            ( same as -Mnumber )
  61.      Sets the top value for the linear amplitude scale
  62. Base frequency: 0
  63.      This specifies the minimum frequency displayed on the plot.  This can be
  64.      used to zoom in on a particular section of the spectrum.
  65. Frequency factor: 1.0
  66.      This specifies the zoom-factor for the frequency axis.
  67. DTMF & CTCSS threshold level: 0.05
  68.      This specifies the threshold level used to discriminate the amplitude
  69.      for the frequency spectral components. This level appears as an
  70.      horizontal line in DTMF & CTCSS decoding modes.
  71. DTMF delay (40 - 250 ms): 80
  72.      This parameter specifies the length of each DTMF number. A standard
  73.      value used by the telephone companies is 90 ms but you can modify this
  74.      as you like.
  75. CTCSS active: 0xABFFFFFD, 0x0001DD2A
  76.      Each bit in these two long integers enables/disables the CTCSS
  77.      frequencies to be scanned. The default values are for those tones that
  78.      are found on most radio transmitters
  79. Background color: 0,0,20    ( sets the background red,green,blue value )
  80. Clipping warning color: 20,0,0
  81.      Sets the background color set when clipping occurs.
  82.      WHY DOES THE SCREEN FLASH ALL OF THE TIME? That is because this color
  83.      is different from the background color. The program changes the
  84.      background color to this color whenever clipping of the signal is
  85.      detected (the sampled signal hits the allowable signal limits.) This
  86.      clipping will result in a distortion of the frequency plot (look at the
  87.      spectrum of a pure whistle when clipping occurs.) The best solution to
  88.      this problem is to lower the input level so that clipping does not
  89.      occur. If this is not possible, you can set this color to the same
  90.      value as the background color, and the screen will not longer flash.
  91. Graph color: 30,35,60        ( sets the color for the FFT graph )
  92. Axis label color: 50,20,45  ( sets the color frequency and amplitude labels )
  93. Border color: 40,40,40        ( sets the color for the border and tick marks )
  94. Text color: 55,55,25        ( sets the color for text (other than labels) )
  95. Cursor upper color: 20,20,20 ( sets the color for the upper half of the cursor )
  96. Cursor lower color: 63,63,63 ( sets the color for the lower half of the cursor )
  97.  
  98. RUNTIME OPTIONS:
  99.  
  100. While the program is running, the following commands may be used:
  101.  
  102. ? : Prints a short list of commands available.
  103. E,Q : Exit from the program.
  104. F : Change the FFT length.
  105. R : Change the sampling rate.
  106. S : Save the current state to an INI file.  The default INI file is DTMF_FFT.INI,
  107.     which will be loaded as the default options.  If a filename is given as
  108.     the first parameter on the command line, the settings from that file
  109.     (which can be created using the "S" command) will be used.
  110. P : Toggle peak display mode on/off (shows the frequency of maximum
  111.     amplitude).
  112. L : Toggle between logarithmic and linear frequency (x axis) scales.
  113. D : Toggle DTMF decoding mode on/off.
  114.     The decoded DTMF numbers are stored in an internal register and can be
  115.     dialed anytime by pressing <tab>.
  116. T : Toggle CTCSS decoding mode on/off.
  117.     Last decoded tone and its on/off state is displayed in real time.
  118. G : Logging on/off for the DTMF & CTCSS modes.
  119.     A log file is created with time & date stamps for easy monitoring.
  120. I : Input a DTMF number and store it in memory.
  121. TAB : Generates the stored DTMF number.
  122. A : Generates a CTCSS sub-audible frequency (selectable from a CTCSS tones
  123.     table). <space> will select/deselect individual tones to be recognized
  124.     in CTCSS decoding mode.
  125.     Program starts with the 38 tones found on most transmitters activated.
  126. V : Redraw the video display.
  127. C : Toggle black&white/color display, useful for screen prints. Note: if
  128.     you want to make a printout of the display, run the DOS program
  129.     GRAPHICS.COM prior to running DTMF_FFT. Before printing, switch to the
  130.     black&white display, and then press Shift-<PrintScreen>. Refer to your
  131.     DOS documentation for more information on the GRAPHICS program.
  132.  
  133. <Up> : increase the amplitude scale
  134. <Down> : decrease the amplitude scale
  135. <Left> : Shift frequency axis to the left (show higher frequencies)
  136. <Right> : Shift frequency axis to the right (show lower frequencies)
  137. '<' : Contract the frequency axis
  138. '>' : Expand the frequency axis
  139.  
  140. <space> : freeze display, put up a cursor, and put up a display of frequency
  141.   and amplitude information. In this mode, the <arrows> keys will move the
  142.   cursor 1-left or 1-right. Use <shift> key and <arrows> for moving the
  143.   cursor with 10-left or 10-right and <Home> or <End> for jumping at the
  144.   start or end of the spectrum. Pressing <enter> will save the data to a
  145.   file, with one frequency bin per line. Each line will contain {frequency}
  146.   and {amplitude}. This data can then be loaded into a spreadsheet or
  147.   plotting program for display.
  148.   Pressing <space> will resume data aquisition.
  149.  
  150. For SB16, and SBPro cards the following keys are also available:
  151.  
  152. (,) Decrease/increase the microphone input level
  153. [,] Decrease/increase the external input level
  154. {.} Decrease/increase the internal (CD) input level
  155.  
  156. NOTES about DTMF and CTCSS modes:
  157.  
  158. 1) The actual sample rates must be integer divisions of the timer frequency,
  159. which is 1.0 MHz for Soundblaster cards. This means actual sampling rates
  160. for Soundblaster cards are: 45.45kHz, 43.48kHz, 41.67kHz, 40kHz, ...
  161. 22.73kHz, 22.22kHz, 21.74kHz, etc. The program will compute the closest
  162. actual sampling rate to the one requested.
  163.  
  164. 2) The specified sampling rate may be above what a Soundblaster can handle.
  165. If this occurs, the Soundblaster will sample at its maximum rate, and the
  166. frequency axis will not reflect the true frequencies.  Typical 8 bit
  167. Soundblasters will only handle sampling rates up to 12kHz.  Newer
  168. Soundblasters can handle sampling rates of at least 44.1kHz, and may be able
  169. to go beyond.
  170.  
  171. 3) The band sample period is the inverse of the frequency resolution. This
  172. is independent of the sampling rate. Today's microprocessors have plenty of
  173. time for doing the IFFT computation and displaying the data even for very
  174. high sample rates during the next data sampling cycle. For the DTMF and
  175. CTCSS modes I have chosen resolutions close to the spacing of the
  176. frequencies I want to detect. That is about 40Hz for DTMF and 2.5Hz for
  177. CTCSS. That will give approximately 20 digits per second in DTMF mode and
  178. about 0.5 second delay in decoding CTCSS tones. Lowering these values will
  179. increase the decoding response time.
  180.  
  181. If you have any questions, bug reports, suggestions, or additions to the
  182. code, please contact me.
  183.  
  184. AUTHORS
  185.  
  186. Emil Laurentiu
  187. Internet:    emil@interlog.com
  188.  
  189. Philip VanBaren
  190. Internet:    phillipv@eecs.umich.edu
  191.  
  192. HISTORY
  193.  
  194. version 1.00
  195.       - first release
  196.  
  197. version 1.10
  198.       - added a log feature. Now you can let the program running and
  199.     all CTCSS frequencies and DTMF numbers will be logged in a file
  200.     with a time stamp.
  201.       - added some CTCSS frequencies not found on the usual TX handies.
  202.     these frequencies can be activated/inactivated separately so only
  203.     those that interest you will be recorded.
  204.       - selected tones can be saved in the .ini file for later use
  205.       - last CTCSS active tone is also displayed
  206.       - changed delay routine for DTMF generation using processor timer
  207.     rather than SB timers (which are not supported on all clones)
  208.       - due to a tremendous request I've decided starting with this
  209.     version to make the program sources available (hope you won't stop
  210.     sending me postcards now :-).
  211.  
  212. ACKNOWLEDGMENTS
  213.  
  214. Most of this program and documentation were derived from Philip VanBaren
  215. program freq51 (version 5.1) who kindly made the sources for this program
  216. available. I thank him again with this opportunity.
  217.  
  218. The program is mainly intended for use by radio-amateurs (HAMS) but other
  219. people might find it useful. The program decodes and generates DTMF codes
  220. and CTCSS codes (this are some "sub-audible" tones used in radio) using
  221. SoundBlaster input and output.
  222.  
  223. I have striped some parts of the program that weren't important for the task
  224. of decoding and generating DTMF/CTCSS and I have supported only SB (normal
  225. ans Pro) and SB16 cards.
  226.  
  227. This program is "cardware" that means if you like this program and you use
  228. it you should send me a post card. (This is a _must_, otherwise I will never
  229. upload my programs again :-). Please send me a postcard with a nature
  230. landscape from your country on the following address:
  231.  
  232.                    Emil LAURENTIU
  233.              Str. Drumea Radulescu nr.42 sect.4
  234.                  Bucharest cod 75126
  235.                    ROMANIA
  236.  
  237. I thank those who already have sent me postcards and letters. I haven't seen
  238. them all yet but my mother tells me they are still coming. Thanks for your
  239. appreciation and nice words.
  240.  
  241. For questions, bug reports, suggestions, or additions to the code concerning
  242. the DTMF and CTCSS part you can contact me at:
  243.  
  244.     Internet: emil@interlog.com
  245.  
  246. The latest version together with some other articles and programs can be
  247. found on my WEB page. The current address is:
  248.  
  249.     http://www.interlog.com/~emil
  250.  
  251. If that changes, use a search engine to find its new location.
  252.  
  253. I am in Canada now, but please send the post-cards to the address in
  254. Romania because that one is a stable one.
  255. My latest email address (together with my PGP public key) can be found by
  256. querying the PGP key-servers (send email with subject line "MGET laurentiu"
  257. to one of these servers (for example to pgp-public-keys@kub.nl)).
  258.  
  259.